extends CanvasLayer


@onready var splash_particles: GPUParticles2D = $splashParticles

#水花参数
var spawn_timer = 0.0
var next_spawn_time = 0.0
var particles_per_spawn = 5  

func _ready() -> void:
	randomize()
	next_spawn_time = 0.5

#func _process(delta: float) -> void:
#
	#
	#spawn_timer += delta
	#if spawn_timer >= next_spawn_time:
		#spawn_timer = 0.0
		#next_spawn_time = randf_range(0.05, 0.2)
		#for i in range(particles_per_spawn):
			#spawn_splash()
#
#func spawn_splash() -> void:
	##创建新粒子实例
	#var splash = splash_particles.duplicate()
	#add_child(splash)
	#
	##设置随机位置（屏幕底部）
	#var viewport_size = get_viewport().size
	#splash.position = Vector2(
		#randf_range(0, viewport_size.x),
		#randf_range(viewport_size.y - 10,viewport_size.y - 10)
	#)
	#
	##设置随机参数
	#splash.amount = randf_range(5, 15)
	#splash.lifetime = randf_range(0.5, 1.5)
	#splash.emitting = true
	#
	##水花播放完成后自动删除
	#await get_tree().create_timer(splash.lifetime).timeout
	#splash.queue_free()
